package com.example.springbootdemo.mapstruct;

import com.example.springbootdemo.bean.dto.UserDTO;
import com.example.springbootdemo.bean.entity.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author hh
 * @date 2022/1/19
 */
@Mapper
public interface UserConvert {

    UserConvert USER_CONVERT = Mappers.getMapper(UserConvert.class);

    @Mapping(source = "userName", target = "name")
    User userDTOToUser(UserDTO userDTO);

}
